<?php
if (!defined('APP_PATH')) {
	define('APP_PATH', $_SERVER['DOCUMENT_ROOT']."/bdACPA");
}
require_once(APP_PATH.'/required.php');
// require('../setup.inc.php');
// include('../auth.php');

//set content type and xml tag
header("Content-type:text/xml");
echo("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");

$out = "";
$out .=  "<items>";
$out .= "	<item type='settings' width='1200' position='label-left' inputWidth='240'/>";
$out .= "	<item type='block' width='1200' >";
$out .= "			<item type='label' name='titreDossier' label=''/>";
$out .= "		<item type='fieldset' width='500' label='Identité'>";
$out .= "			<item type='hidden' name='idDossier' value=''/>";
$out .= "			<item type='input' width='150' name='numero' label='Numero' value='' validate='NotEmpty'/>";
$out .= "			<item type='checkbox' name='foetus' label='Foetus' checked='false' />";
$out .= "			<item type='label' label='Sexe'/>";
$out .= "				<item type='radio' name='sexe' label='M' value='M'  />";
$out .= "				<item type='radio' name='sexe' label='F' value='F'  />";
$out .= "				<item type='radio' name='sexe' label='I' value='I'  />";
$out .= "		</item>";
$out .= "		<item type='newcolumn' offset='100'/>";
$out .= "			<item type='label' name='titre2' label='.'/>";
$out .= "		<item type='fieldset' width='500' label='Renseignements'>";
$out .= "			<item type='hidden' name='idCentre'  value=''/>";
$out .= "			<item type='input' name='centre' label='Centre' value='' validate='NotEmpty' readonly='1'/>";
$out .= "			<item type='combo' name='medecin' label='Médecin prescripteur' validate='NotEmpty' readonly='1'>";
$out .= "			</item>";
$out .= "		</item>";
$out .= "	</item>";
$out .= "	<item type='fieldset' width='1200' label='Clinique'>";
$out .= "	<item type='block' width='1200' >";
$out .= "		<item type='checkbox' name='atteint' label='Est atteint' checked='false'  />";
$out .= "		<item type='combo' name='categorieBiomed' inputWidth='800' label='Catégorie' tootip='Catégorie de l&apos;agence de biomédecine' validate='NotEmpty' readonly='1'>";
$cats = $CATEGORIEBIOMED_DAO->recherche_combo();
$out .= "<option value='0' text='à définir'/>";
$type = "";
foreach ( $cats as $cat)
{
	if ($cat->idtypecategorie == 1){
		$type = "Prénatal";
	} else if ($cat->idtypecategorie == 2){
		$type = "Postnatal";
	}
	else if ($cat->idtypecategorie == 3){
		$type = "Foetopathologie";
	}
	$out .= "<option value='".intval($cat->idcategorie)."' text='".$type." - ".remove_carspeciaux($cat->libelle)."'/>";
}
$out .= "		</item>";
$out .= "	</item>";
$out .= "	<item type='block' width='1100' >";
$out .= "	<item type='fieldset' width='1100' label='Phénotypes'>";
$out .= "	<item type='block' width='1100' >";
 $phenotypePeres = $PHENOTYPEPERE_DAO->rechercher_phenotype_pere();
 $i=0;
 foreach ( $phenotypePeres as $phenotypePere){
 	$out .= "	<item type='fieldset'  width='450' label='".$phenotypePere->libelle."' >";
 	$phenotypes = $PHENOTYPE_DAO->rechercher_phenoByPere($phenotypePere->idphenotypepere);
 	foreach ( $phenotypes as $phenotype)
 	{
 		$out .="<item type='checkbox' position='label-right' label='".remove_carspeciaux($phenotype->libelle)."' name='pheno_".$phenotype->idphenotype."' value='1'  />";
 		if (substr($phenotype->idHPO, 0, 5) =="autre"){
 			$out .= "<item type='input' name='autre_".$phenotype->idphenotype."' label='Préciser' value=''/>";
 		}
 	}
 	$out .= "		</item>";
 	if ( $i == 6 ){
 		$out .= "		<item type='newcolumn' offset='100'/>";
 	}
 	$i++;
 }
 $out .= "		</item>";
 //autre phenotype
 $out .= "			<item type='input' name='autrephenotype' inputWidth='1000' label='Autres indications sur le phénotype' tooltip='Entrer ici les informations sur le phénotype qui vous semblent utiles et qui ne peuvent pas être entrées au dessus' value='' rows='8'/>";
 
 $out .= "	</item>";
$out .= "</item>";

$out .= "</item>";
$out .= "</items>";
print($out);
?>